<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>v-bind动态绑定class(数组语法)</title>
</head>

<body>
  <div id="root">
    <!-- 数组里加单引号是字符串，不加是变量 -->
    <h2 class="title " :class="['active',line]">{{message}}</h2>
    <h2 class="title " :class="getClasses()">{{message}}</h2>
  </div>
  <script src="../practice_project/js/vue.js"></script>
  <script>
    const root = new Vue({
      el: '#root',
      data: {
        message: 'v-bind动态绑定class(数组语法)',
        line: 'aaaa'
      },
      methods: {
        getClasses: function () {
          return ['active', this.line]
        }
      }
    })
  </script>
</body>

</html>